import React, {useEffect, useRef} from 'react';
import {Button,Layout,Row, Col} from 'antd';
import {useSize} from 'ahooks';
export default ()=>{
  useEffect(()=>{

  },[]);
  const size = useSize(useRef());
  const open = (url:string)=>{
    if(!url.startsWith("http://")){
      url = "http://localhost:8888/"+ url;
    }
    window.POBrowser.openWindowModeless(url,'width=1000px;height=900px;');
  };
  const showWord = ()=> open('word/show');
  const showPdf = ()=> open('pdf/show');
  const showExcel = ()=> open('excel/show');

  const editWord = ()=> open('word/edit');
  const editExcel = ()=> open('excel/edit');
  return (
    <Layout>
      <Row>
        <Col span={1}><Button onClick={showWord}>打开 Word</Button></Col>
        <Col span={1}><Button onClick={showPdf}>打开 Pdf</Button></Col>
        <Col span={1}><Button onClick={showExcel}>打开 Excel</Button></Col>

        <Col span={1} offset={1}><Button onClick={editWord}>编辑 Word</Button></Col>
        <Col span={1}><Button onClick={editExcel}>编辑 Excel</Button></Col>
      </Row>

    </Layout>
  )

}
